class Solution {
public:  //单调性+左右指针
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1, ret = 0;
        while(left < right)  
        {
            int V = min(height[left], height[right]) * (right - left); //计算容积
            ret = max(ret, V);  //更新容积
            if(height[left] < height[right])  left++; //移动指针，值小的指针移动
            else  right--;
        }
        return ret;
    }
};